/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ImagenesDBGad.IO;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;

/**
 *
 * @author NiCo
 * http://code.google.com/p/imagenesdb-gad/source/browse/
 */
@Entity
public class Objeto implements Serializable {

    @ManyToOne
    private Imagen imagen;
    @OneToMany(mappedBy = "objeto", cascade = CascadeType.PERSIST)
    private List<Punto> puntos;
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    private String xmlPath;
    //Vertice superior izquierdo
    private float v1x;
    private float v1y;
    //Vertice inferiror derecho
    private float v2x;
    private float v2y;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Imagen getImagen() {
        return imagen;
    }

    public void setImagen(Imagen imagen) {
        this.imagen = imagen;
    }

    public List<Punto> getPuntos() {
        return puntos;
    }

    public void setPuntos(List<Punto> puntos) {
        this.puntos = puntos;
    }

    public String getXmlPath() {
        return xmlPath;
    }

    public void setXmlPath(String xmlPath) {
        this.xmlPath = xmlPath;
    }

    public float getV1x() {
        return v1x;
    }

    public void setV1x(float v1x) {
        this.v1x = v1x;
    }

    public float getV1y() {
        return v1y;
    }

    public void setV1y(float v1y) {
        this.v1y = v1y;
    }

    public float getV2x() {
        return v2x;
    }

    public void setV2x(float v2x) {
        this.v2x = v2x;
    }

    public float getV2y() {
        return v2y;
    }

    public void setV2y(float v2y) {
        this.v2y = v2y;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof Objeto)) {
            return false;
        }
        Objeto other = (Objeto) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Objeto{" + "xmlPath=" + xmlPath + '}';
    }
}
